package org.example.wikwok.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.example.wikwok.pojo.Follow;
import org.springframework.stereotype.Repository;

@Repository
public interface FollowMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Follow record);

    int insertSelective(Follow record);

    Follow selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Follow record);

    int updateByPrimaryKey(Follow record);

    @Select("SELECT COUNT(*) FROM follow WHERE followedUserId = #{followedUserId}")
    int selectFollowedCount(Integer followedUserId);

    @Delete("DELETE FROM follow WHERE followerUserId = #{followerId} AND followedUserId = #{id}")
    void deleteByFollowerIdAndUserId(int followerId, int id);
}